Crate bittle[][src]

A library for working with small and cheap bit sets and masks

Masks keep track of usize indexes which are set through testing. This allows for masking indexes in certain operations. Like if you want to mask which channels in an audio buffer is in use or not.

Examples

fn test<M>(mask: M) where M: bittle::Mask {
    assert!(!mask.test(0));
    assert!(mask.test(1));
}

let mut set = bittle::BitSet::<u16>::empty();
set.set(1);

test(&set);

set.clear(1);

assert_eq!(std::mem::size_of_val(&set), std::mem::size_of::<u16>());

Macros

bit_set

Construct a bit set with specific values set.

Structs

BitSet

A fixed size bit set.

Traits

Mask

A trait used to check if an index is masked.

Functions

all

Construct the special mask where every index is set.

none

Construct the special mask where no index is set.